package com.example.database.tables;

import androidx.room.TypeConverter;

import com.blankj.utilcode.util.GsonUtils;

import java.util.ArrayList;

/**
 *数据库字段转换 数组转换字段
 * */
public class CustomTypeConverter {
    @TypeConverter
    public  String arrListToString(ArrayList<String> data) {
        return GsonUtils.toJson(data);
    }

    @TypeConverter
    public ArrayList<String> stringToArrList(String json) {
        return GsonUtils.fromJson(json, ArrayList.class);
    }

}
